﻿Ext.define('Admin.view.order.OrderGrid', {
	extend: 'Ext.grid.Panel',
	id: 'orderGrid',
	xtype: 'order-grid',
	title: '订单列表',
	iconCls: 'x-fa fa-file-text',
	//cls: 'user-grid',

	controller: 'order',			//视图控制器
	viewModel: { type: 'order' },	//视图数据模型
	bind: '{orderGridStore}',		//viewModeld的store
	//sm:new Ext.grid.CheckboxSelectionModel(),
	selModel: {
		selType: 'checkboxmodel',
		//checkOnly: true,
		showHeaderCheckbox: true
	},
	columns: [
		{ header: '订单编号', dataIndex: 'orderId', width: 80, sortable: true, hidden: true }
		, { header: '申请人', dataIndex: 'userName', width: 80, sortable: true }
		, { header: '部门', dataIndex: 'departmentName', width: 60, sortable: true }
		, { header: '晚餐', dataIndex: 'dinner', width: 50, sortable: true }
		, { header: '宵夜', dataIndex: 'nightSnack', width: 50, sortable: true }
		, { header: '次日早餐', dataIndex: 'breakfast', width: 75, sortable: true }
		, { header: '次日午餐', dataIndex: 'lunch', width: 75, sortable: true }
		, { header: '申请时间', dataIndex: 'applyTime', width: 145, sortable: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') }
		, { header: '状态', dataIndex: 'state', width: 60, sortable: true }
		, { header: '审批人', dataIndex: 'approver', width: 180, sortable: true }
		, { header: '审批时间', dataIndex: 'approvalTime', width: 145, sortable: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') }

		, {
			xtype: 'actioncolumn',
			items: [{
				xtype: 'button',
				iconCls: 'x-fa fa-eye',
				tooltip: "查看",
				handler: 'onClickBackReasonButton'
			}
			],
			cls: 'content-column',
			width: 80,
			dataIndex: 'bool',
			text: '驳回原因'
		}
	],
	dockedItems: [{
		xtype: 'pagingtoolbar',
		dock: 'bottom',
		bind: '{orderGridStore}',	//viewModeld的store
		displayInfo: true,
		displayMsg: '显示第 {0} - {1} 条数据 总计 {2}',
		emptyMsg: "没有任何数据",
		items: ['-', {
			text: '添加申请',
			iconCls: 'x-fa fa-plus',
			listeners: {
				click: 'onClickOrderGridAddButton'
			}
		}, '-', {
				text: '更新申请',
				iconCls: 'x-fa fa-pencil',
				listeners: {
					click: 'onClickOrderGridUpdateButton'
				}
			}, '-', {
				text: '删除申请',
				iconCls: 'x-fa fa-close',
				listeners: {
					click: 'onClickOrderGridDeleteButton'
				}
			}, '-', {
				text: '申请审批',
				iconCls: 'x-fa fa-arrow-up',
				listeners: {
					click: 'onClickStartButton'
				}
			}]
	}]
});